import { createRouter, createWebHashHistory, createWebHistory } from "vue-router"

const routes = [
    {
        path: "/",
        name: "layout",
        component: () => import("../views/Layout/index.vue"),
        redirect: "/home",
        children: [
            {
                path: 'home',
                name: "home",
                component: () => import("../views/Home/index.vue")
            },
            {
                path: "institute",
                name: "institute",
                component: () => import("../views/institute/index.vue"),
            },
            {
                path: "institute",
                name: "institute",
                component: () => import("../views/institute/index.vue"),
            },
            {
                path: "news",
                name: "news",
                component: () => import("../views/institute/news.vue"),
            },
            {
                path: "project",
                name: "project",
                component: () => import("../views/project/project.vue"),
            },
            {
                path: "projectCount",
                name: "projectCount",
                component: () => import("../views/project/projectCount.vue"),
            },
            {
                path: "contact",
                name: "contact",
                component: () => import("../views/contact/contact.vue"),
            },
            {
                path: "about",
                name: "about",
                component: () => import("../views/about/index.vue"),
            },
        ]
    },

]

const router = createRouter({
    history: createWebHistory(),
    routes,
    scrollBehavior(to, from, savedPosition) {
        // 返回到页面顶部
        return { top: 0 };
    },
})

export default router